package pers.li.controller.order;

import pers.li.model.Address;
import pers.li.service.AddressService;
import pers.li.utils.PublicUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/order/confirmOrder.action")
public class ConfirmOrder extends HttpServlet {
    private final AddressService addressService = new AddressService();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Integer userId = PublicUtils.getLoginUserId(req);
        List<Address> addressList = addressService.getAddressListByUserId(userId);
        req.setAttribute("addressList",addressList);
        req.getRequestDispatcher("confirm_order.jsp").forward(req,resp);
    }
}
